package controller

import (
	"github.com/gin-gonic/gin"
	//	"net/http"
)

// 初始化router类型的对象，首字母大写，用于挎包调用
var Router router

type router struct{}

//初始化路由规则
func (r *router) InitApiRouter(router *gin.Engine) {
	router.
		GET("/api/k8s/namespaces", Namespace.GetNamespaces).
		GET("/api/k8s/namespace/detail", Namespace.GetNamespaceDetail)

	// This router is showing pod/Users/chaofeng/files/前端项目/vue/teresa-fe/src/views/pod/Pod.vue
	router.
		GET("/api/k8s/pods", Pod.GetPods).
		GET("/api/k8s/pod/detail", Pod.GetPodDetail).
		DELETE("/api/k8s/pod/del", Pod.DeletePod).
		GET("/api/k8s/nodepods", Pod.GetNodePods).
		GET("/api/k8s/pod/container", Pod.GetPodContainer).
		GET("/api/k8s/pod/log", Pod.GetPodLog).
		GET("/api/k8s/ns/podnumber", Pod.GetPodNumberNp)
	// This router is showing deployment
	router.
		GET("/api/k8s/deploys", Deploy.GetDeploys).
		GET("/api/k8s/deploy/detail", Deploy.GetDeployDetail).
		GET("/api/k8s/ns/deploynumber", Deploy.GetDeployNumberNp).
		POST("/api/k8s/deploy/create", Deploy.CreateDeployment).
		POST("/api/k8s/deploy/scale", Deploy.UpdateDeployScale).
		GET("/api/k8s/deploy/scalenum", Deploy.GetDeployScale).
		PUT("/api/k8s/deploy/update", Deploy.UpdateDeployment).
		POST("/api/k8s/deploy/restart", Deploy.RestartDeployment).
		DELETE("api/k8s/deploy/del", Deploy.DeleteDeploy)
	router.
		GET("/api/k8s/daemonsets", Daemonset.GetDaemonsets).
		GET("/api/k8s/daemonset/detail", Daemonset.GetDaemonsetDetail).
		POST("/api/k8s/daemonset/create", Daemonset.CreateDaemonset).
		DELETE("/api/k8s/daemonset/del", Daemonset.DeleteDaemonset)
	router.
		GET("/api/k8s/services", Servicev1.GetServices).
		GET("/api/k8s/service/detail", Servicev1.GetServiceDetail).
		PUT("/api/k8s/service/update", Servicev1.UpdateService).
		POST("/api/k8s/service/create", Servicev1.CreateService).
		DELETE("/api/k8s/service/delete", Servicev1.DeleteService)
	router.
		GET("/api/k8s/ingresses", Ingress.GetIngresses).
		GET("/api/k8s/ingress/detail", Ingress.GetIngressDetail).
		POST("/api/k8s/ingress/create", Ingress.CreateIngress).
		DELETE("/api/k8s/ingress/delete", Ingress.DeleteIngress)
	router.
		GET("/api/k8s/nodes", Node.GetNodes).
		GET("/api/k8s/node/detail", Node.GetNodeDetail)

	router.
		GET("/api/k8s/configmaps", Configmap.GetConfigMaps).
		GET("/api/k8s/configmap/detail", Configmap.GetConfigMapDetail).
		DELETE("/api/k8s/configmap/delete", Configmap.DeleteConfigMap).
		POST("/api/k8s/configmap/update", Configmap.UpdateConfigMap)
	router.
		GET("/api/k8s/workflows", Workflow.GetList).
		GET("/api/k8s/workflow/detail", Workflow.GetWorkflowById).
		DELETE("/api/k8s/workflow/del", Workflow.DelWorkflowById).
		POST("/api/k8s/workflow/create", Workflow.CreateWorkflow)
}
